﻿using System;
using System.Reflection;
using FileDistributor.Monitoring;
using log4net;

namespace FileDistributor
{
    public class BootStrapper
    {
        private readonly ILog _logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        public void Start()
        {
            _logger.Info("Starting...");

            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
            PickupLocationMonitorHelper.StartMonitoringPickupLocations();
        }


        public void Stop()
        {
            _logger.Info("Shutting down...");
        }

        void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            _logger.Error(e.ExceptionObject.ToString());
        }
        
    }
}
